home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group02b.txt
/
000013_icon-group-sender_Mon Aug 19 12:51:00 2002.msg
< prev
next >
Wrap
Internet Message Format
|
2003-01-02
|
5KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g7JJouc13314
for icon-group-addresses; Mon, 19 Aug 2002 12:50:56 -0700 (MST)
Message-Id: <200208191950.g7JJouc13314@baskerville.CS.Arizona.EDU>
From: Christopher Browne <cbbrowne@acm.org>
X-Newsgroups: comp.lang.icon
Subject: Re: What about "Expressions?" (was Re: Icon Wish List)
Date: 17 Aug 2002 01:25:39 GMT
X-Draft-From: ("nnvirtual:Languages" 619)
X-Home-Page: http://www.cbbrowne.com/info/
X-Emacs-Acronym: Experience the Mildest Ad Campaign ever Seen
Microsoft: I'm not laughing anymore.
X-Shopping-List:
(1) Assiduous buds
(2) Presidential incongruous capture enemas
(3) Scrumptious erosion circumlocutions
X-Uboat-Death-Message: TORPEDOED BY SALESMEN. UNABLE TO DIVE. SINKING. U-244.
To: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
The world rejoiced as Jesse Tov <tov@fas.harvard.REMOVE.edu> wrote:
> Gene Kahn <jenjhiz@yahoo.com>:
>> previous statements. On the other hand, in reading s-expression
>> languages like Lisp and Scheme, I find that I have to hold in my mind
>> too many _unstated_ intermediate results before I find what the
>> expression is all about. (One could argue that this may be due more to
>> bad code, i.e., irresponsible use of deep embedding, than to intrinsic
>> properties of s-expressions).
>
> I would argue that it's bad code. That's what "let" ("let"
> in ML, "let*" in Scheme) is for. (I don't know Lisp well
> enough, but I bet there's something equivalent.)
Lisp was there first with LET and LET*. The ML way is a bit more
obviously expressive; code might assortedly look like:
(LET* ((A 1)
(B (* A 2)))
(+ A B))
which expands to
(let ((a 1))
(let ((b (* a 2)))
(+ a b)))
which is rather like
let a = 1
in let b = a * 2
in a + b;;
Contrast with
(let ((a 1)
(b 2))
(* a b))
which is like
let a = 1 and b = 2 in a * b;;
>> Compare the readability of these chunks
>> of code:
>>
>> FORTRAN-like
>> The man kicked the dog.
>> The dog chased the cat.
>> The cat bit the mouse.
>> The mouse died.
>>
>> LISP-like (in infix notation)
>> The mouse the cat the dog the man kicked chased bit died.
>
> ML-like
> The man kicked the dog
> which chased the cat
> which bit the mouse
> which died.
>
> (OK, so "let" to "which" is sort of a stretch, but "which"
> lets you stop remembering everything and encapsulate it as a
> temporary variable, a "pronoun," if you will. It makes the
> sentence right-branching, and thus easier to read.)
>
>> Speaking of speaking (or writing) grammatical English, which skill has
>> been implied in a recent post as a 'requisite' for programming, what
>> do readers with good English grammar think of this sentence:
>> grammatically correct or not? Be careful with your answer. Your
>> reputation as a programmer is on the line.
>>
>> The horse raced past the barn collapsed.
>
> Well, I can't find any way to parse it that has the barn collapsing
> rather than the horse. In my dialect, it's is equivalent to
> The horse which was raced past the barn collapsed.
> and is perfectly grammatical. However, I know in some people's
> dialects (my grandfather, from eastern Pennsylvania), it's more like:
> The horse which raced past the barn collapsed.
> When I hear it like this, it's ungrammatical to me.
The problem here isn't grammar; it's semantics, and semantics that
don't make sense.
If we changed the last word from "collapsed" to "upright", it would
read:
The horse raced past the barn upright.
The problem isn't with the barn; it's not with racing; its that if the
horse is "collapsed," it doesn't make sense for it to be able to have
"raced" past the barn. Being in a state of collapse would generally
_end_ any racing.
The sentence demonstrates why we have punctuation. It makes a bit
more sense (or at least the ambiguity of what "collapsed" attaches to
gets broken a bit) if we add a comma:
The horse raced past the barn, collapsed.
The problem with Perl is that it winds up slathering massive amounts
of punctuation in everywhere, $whether @YOU %{want} $(it)++ or not.
In human language, we want to have a _few_ accents here and there that
break things up where they are needed. A comma or two per line, a
period in each sentence, and a colon or semicolon once in a while to
indicate significant pauses. Perl goes hogwild on punctuation, which
gets really annoying after a while.
That sample sentence probably needed an extra comma even though it
wasn't strictly necessary in much the way that arithmetic operations
often read much better with a few extra parentheses that allow the
reader to avoid the need to puzzle through the specific order of
bindings of arithmetic operations for the given language.
--
(concatenate 'string "cbbrowne" "@acm.org")
http://www3.sympatico.ca/cbbrowne/spiritual.html
This login session: $13.99